@isTest
private class FeedbackTest {
    static testMethod void testMethod1() {
        
        Province__c pvin = new Province__c();
		pvin.Name ='四川';
		insert pvin ; 

		City__c ct = new City__c();
		ct.Name = '成都市';
		ct.Province__c = pvin.Id  ; 
		insert ct ;
		District__c dt = new District__c();
		dt.City__c  = ct.Id ; 
		dt.Name = '郫县';
		insert dt ; 

		Account acc = TestUtils.createAccount();
		acc.Level__c = '一级医院';
		acc.Province__c  = pvin.Id ; 
		acc.City__c = ct.Id; 
		acc.District__c = dt.Id; 

		insert acc;

		  Brand__c brand = new Brand__c(
            Name = '迈克生物',
            BrandShortName__c = '迈克生物'
            );
        insert brand;
		 //创建产品结构
        ProductStructure__c ps1 = new ProductStructure__c(
        	Classify1__c='仪器'
        );
        insert ps1;
		Product__c pro = TestUtils.createProduct();
		pro.Category0__c='仪器';
		pro.ProductStructure__c = ps1.Id ; 
		pro.CRMBrand__c = brand.Id;
		pro.RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('NCProduct', 'Product__c');

		insert pro;

		Dealer__c d = new Dealer__c(
        Name = 'xxxxx',
        Only__c = '13455666'

        );
      insert d;


        
        Case case2 = new Case(
			RecordTypeId=Utils.getRecordTypeIdByDevNameAndObjName('Service', 'Case'),
			Account=acc,
			Origin='电话',
			Status='处理中',

			Manufacturer__c=pro.Id);
        case2.Servicetype__c = '工程';

		insert case2;
      


		WorkOrder__c WO2 = new WorkOrder__c(

			RecordTypeId=Utils.getRecordTypeIdByDevNameAndObjName('ServiceOrder', 'WorkOrder__c'),
			Case__c=case2.Id,
			Status__c='生单',
			Account__c = acc.Id,
			WhetherToMakeASingle__c='否');
		WO2.UserDepartmentContact__c = [select Id from Contact where AccountId =:acc.Id limit 1].Id;
		insert WO2;


		Feedback__c fb = new Feedback__c();
		fb.WorkOrder__c = WO2.Id;
		insert fb;


    }
}